/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package z.h.w.jar.arithmetic;

import java.util.List;
import z.h.w.jar.arithmetic.method.SortMethodApi;

/**
 *
 * @author EnzoZhong @date 2011.09.15
 */
public class Sort {

     /**
      *
      * @param <Type>
      * @param array
      * @param sortMethod
      *
      * @return
      */
     public synchronized static <Type extends Comparable<? super Type>> Type[] sort ( Type[] array , SortMethodApi sortMethod ) {
          if ( array.length == 1 ) {
               return array;
          }
          return sortMethod.sort ( array );
     }

     /**
      *
      * @param <Type>
      * @param list
      * @param sortMethod
      *
      * @return
      */
     public synchronized static <Type extends Comparable<? super Type>> List<Type> sort ( List<Type> list , SortMethodApi sortMethod ) {
          if ( list.size () == 1 ) {
               return list;
          }
          return sortMethod.sort ( list );
     }

}
